<?php
/*
# ------------------------------------------------------------------------
# JA Job Board Package
# ------------------------------------------------------------------------
# Copyright (C) 2004-2010 JoomlArt.com. All Rights Reserved.
# @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
# Author: JoomlArt.com
# Websites: http://www.joomlart.com - http://www.joomlancers.com.
# ------------------------------------------------------------------------
*/

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die( 'Restricted access' );


/**
 * @package		Joomla
 * @subpackage	JobBoard
 */
class JobBoardTableJA_Feeds extends JTable
{
	/** @var int Primary key */
	var $id				= null;
	/** @var string */					
	var $feed_name 			= null;
	
	var $feed_alias			= null;
	
	/** @var int */
	var $feed_description		= null;	
	/** @var string */  
	var $feed_type		= null;
	/** @var string */  
	var $feed_cache		= null;
	
	var $feed_imgUrl = null;
	
	var $feed_button = null;
	
	var $feed_renderAuthorFormat = null;
	
	var $feed_renderHTML = null;
	
	var $feed_renderImages = null;
	
	var $msg_count = null;
	
	var $msg_orderby = null;
	
	var $msg_numWords = null;
	
	var $filter_cat_id = null;
	
	var $filter_location_id = null;
	
	var $filter_date = null;
	
	var $filter_is_premium = 0;
	
	var $filter_employer = null;
	
	var $msg_fulltext  = null;
	
	var $filter_exitems = null;
	
	var $filter_exemployers = null;
	
	var $filter_inemployers = null;
	
	var $published = null;
	
	var $is_user = null;
	
	var $filter_zipcode = null;
	/**
	* @param database A database connector object
	*/
	function __construct(&$db)
	{
		parent::__construct( '#__ja_feeds', 'id', $db );
	}
	
	function check()
	{
		JFilterOutput::objectHTMLSafe($this,ENT_QUOTES,'');
		//Check alias unique
		$temp_feed = getItemByFieldName('ja_feeds','feed_alias','"'.$this->feed_alias.'"');
		if (count($temp_feed)>=1)
		if ($temp_feed[0]->id!=$this->id)
		{
			JError::raiseWarning(1,JText::_("Feed alias is already exist"));
			return 'FAIL';
		}
		return 'SUCCESS';
	}
	function load($key)	
	{
		parent::load($key);
		$this->feed_name = JFilterInput::_decode($this->feed_name);
		$this->feed_name = JFilterInput::clean($this->feed_name);
		$this->feed_alias = JFilterInput::_decode($this->feed_alias);
		$this->feed_alias = JFilterInput::clean($this->feed_alias);
		$this->feed_description = JFilterInput::_decode($this->feed_description);
		return $this;
	}
}